package net.moao.netutils;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Toast;

import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;

import net.moao.netutils.databinding.ActivityMenuBinding;

public class MenuActivity extends AppCompatActivity implements View.OnClickListener {
    public static final String TAG = "MenuActivity";
    Activity mActivity;
    ActivityMenuBinding binding;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        binding = ActivityMenuBinding.inflate(getLayoutInflater());
        setContentView(binding.getRoot());

        mActivity = this;
        binding.btnStartTCPServerActivity.setOnClickListener(this);
        binding.btnStartTCPClientActivity.setOnClickListener(this);
        binding.btnStartHttpActivity.setOnClickListener(this);
        binding.btnAbout.setOnClickListener(this);
    }

    @Override
    public void onClick(View view) {
        if (view.getId() == binding.btnStartTCPServerActivity.getId()){
            Toast.makeText(getApplicationContext(), "灰度测试中，敬请期待，想要提前使用请安装预览版。", Toast.LENGTH_SHORT).show();
        } else if (view.getId() == binding.btnStartTCPClientActivity.getId()){
            // 第一个参数是当前Activity 第二个参数是要启动的Activity
            Intent intent = new Intent(MenuActivity.this,MainActivity.class);
            startActivity(intent);
        } else if (view.getId() == binding.btnStartHttpActivity.getId()) {
            // 第一个参数是当前Activity 第二个参数是要启动的Activity
            Intent intent = new Intent(MenuActivity.this,HttpActivity.class);
            startActivity(intent);
        } else if (view.getId() == binding.btnAbout.getId()){
            Intent intent = new Intent(MenuActivity.this,AboutActivity.class);
            startActivity(intent);
        } else {
            Toast.makeText(mActivity, "敬请期待", Toast.LENGTH_SHORT).show();
        }
    }
}